﻿namespace LHA.Parsing.HTML
{
    using System.Collections.Generic;

    /// <summary>
    /// Class that holds information about tag, its
    /// - name (like html, title, div, p, a, ...
    /// - attributes - list of pairs name/value of attribute (name="value")
    /// - children - tahs that are on lower level related to this one, IN PRESENT VERISON NOT IMPLEMENTED !!!
    /// [LHA]: 03/2010 (mailto:lha.dev@gmail.com)
    /// </summary>
    public class TagItem
    {
        #region .: props :.

        public string Name { get; set; }

        public Dictionary<string, string> Attributes { get; set; }

        public List<TagItem> Children { get; set; }

        #endregion

        #region .: ctors :.

        public TagItem()
            : this(null, null, null)
        {
        }

        public TagItem(string Tag)
            : this(Tag, null, null)
        {

        }

        public TagItem(string Tag, Dictionary<string, string> Attributes)
            : this(Tag, Attributes, null)
        {
        }

        public TagItem(string Tag, Dictionary<string, string> Attributes, List<TagItem> Children)
        {
            this.Name = Tag;
            this.Attributes = Attributes != null ? Attributes : new Dictionary<string, string>();  //always initialize!
            this.Children = Children != null ? Children : new List<TagItem>();  //always initialize!
        }

        #endregion
    }
}
